import os
# import pandas as pd
import openpyxl
# from openpyxl.styles import PatternFill
#
pth1 = os.getcwd() + "/sample1.xlsx"
#
# df = pd.read_excel(pth1, sheet_name='Sheet1', index_col=False)
# print(df)
wb = openpyxl.load_workbook(pth1)
ws = wb['Sheet1']

# print(ws['B4'].fill.start_color.index)


for ri, r in enumerate(ws):
    if ri in [0, 1]:
        continue
    for ci, c in enumerate(r):
        print(c.fill.start_color.index)

# from xlrd import open_workbook
# # from webcolors import rgb_to_name
#
# wb = open_workbook(pth1)
# sh = wb.sheet_by_name('Sheet1')
#
# def getBGColor(book, sheet, row, col):
#     xfx = sheet.cell_xf_index(row, col)
#     xf = book.xf_list[xfx]
#     bgx = xf.background.pattern_colour_index
#     pattern_colour = book.colour_map[bgx]
#
#     #Actually, despite the name, the background colour is not the background colour.
#     #background_colour_index = xf.background.background_colour_index
#     #background_colour = book.colour_map[background_colour_index]
#
#     return pattern_colour
#
# rgb_Col = getBGColor(wb, sh, 0, 0)
# print(rgb_Col)
# # print("The RGB value of the cell is: {} which is equivalent to {}".format(rgb_Col, rgb_to_name(rgb_Col)))
